 /**************************************************************************//**
 * \file    siklon_internal.h
 * \author  İsmail SEZEN
 * \email:  sezenismail@gmail.com
 * \date    06.02.2011
 *
 * <b>Description</b>
 *
 * This is a header file and contains needed data structs for the siklon project.\n
 *
 * Copyright (C) 2010 İsmail SEZEN
 *
 * <b>License</b>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *****************************************************************************/

/* File Info Structs *///{

/*! \brief Holds the dimension properties
 *
 *  This struct holds a dimension's length and identifier. */
struct dimension{
	size_t len;
	int id;
};

/*! \brief Holds all of the dimensions defined in NC file. */
struct dimensions {
	struct dimension lon;
	struct dimension lat;
	struct dimension level;
	struct dimension time;
	int count;
};

/*! \brief This is a double min and max range struct
 *
 *  This struct holds a range defined double \a min and \a max */
struct range_double{
	double min;
	double max;
};

/*! \brief This is a float min and max range struct
 *
 *  This struct holds a range defined float \a min and \a max */
struct range_float{
	float min;
	float max;
};

/*! \brief This is a attribute holder and holds properties of an attribute defined in NC file. */
struct attr_level {
	char* units;
	char* long_name;
	struct range_float actual_range;
	char* positive;
	short GRIB_id;
	char* GRIB_name;
};

/*! \brief Struct to hold the latitude and longtitude attributes */
struct attr_latlon {
	char* units;
	char* long_name;
	struct range_float actual_range;
};

/*! \brief Struct to hold the time attributes */
struct attr_time {
	char* units;
	char* long_name;
	char* delta_t;
	struct range_double actual_range;
};

/*! \brief Struct to hold the geoptantial height (hgt) attributes */
struct attr_hgt {
	char* long_name;
	struct range_float actual_range;
	struct range_float valid_range;
	char* units;
	float addOffset;
	float scaleFactor;
	short missing_value;
	short GRIB_id;
	char* GRIB_name;
	char* var_desc;
};

/*! \brief Struct for all attributes in the NC file */
struct var_attributes {
	struct attr_time time;
	struct attr_hgt hgt;
	struct attr_level level;
	struct attr_latlon lat;
	struct attr_latlon lon;
};

/*! \brief Holds the id of variables */
struct VarId{
	int nc, hgt, lon, lat, time,level;
};

/*! \brief Struct to hold info about the NC file */
struct file_info {
	struct dimensions dims;
	struct var_attributes attr;
	struct VarId id;
};

//}

/* Domain Structs *///{

/*! \brief This struct holds initial index conditions */
struct BoundryIndex{int start,end;};

/*! \brief This struct holds the boundry info about time */
struct BoundryTime{
	struct BoundryIndex index;
	int step;
};

/*! \brief This struct holds the boundry info about latitude, longtitude */
struct BoundryGeo {
	float start;
	float end;
	float step;
	struct BoundryIndex index;
};

/*! \brief This struct holds the arrays of Latitudes, Longtitudes and Times */
struct DimsArray {
	float* levs;
	float* lats;
	float* lons;
	double* times;
};

/*! \brief Domain struct that will be examined. */
struct Domain {
	struct BoundryGeo lat, lon;
	struct BoundryTime time;
	struct DimsArray dims;
	int level;
};

//}

/* Data type to store the cyclones*///{

/*! \brief Determines the properties of cyclone/anti-cyclone. This struct is the element of a double-linked list. */
struct cyclone_item {
	double time;
	int level;
    double lat;
    double lon;
    double height;
    struct cyclone_item* next;
    struct cyclone_item* prev;
};

/*! \brief This struct holds the nmber of some stuff */
struct COUNT{
	int raw;
	int eliminated;
	int net;
};

/*! \struct CYCLONE
 * \brief this struct used to hold the cyclones that found
 */
struct CYCLONE {
    /*! \brief this is the first cyclone in the double-linked list */
	struct cyclone_item* first;
	/*! \brief this is the last cyclone in the double-linked list */
	struct cyclone_item* last;
	/*! \brief Cyclone count in the double-linked list */
	struct COUNT count;
};
//}

/*! \brief this struct used to hold the domain properties that we examine */
struct Domain dom;
/*! \brief this struct used to hold the domain properties that we examine */
struct file_info info;
